import { request } from "@/utils/request.js"
import applicationViewMockData from "@/mock/data/cloudResources/index.js"


function query(mockDataName) {
    const { integrationData, catalog } = applicationViewMockData;
    const { data: result } = integrationData[catalog.indexOf(mockDataName)];
    return { data: result }
}

/**
 * 云资源总览
 * @param {} options 
 * @returns 
 */
export function getAppUsageRateData(options = {}) {
    return request({
        url: `sjzt/yzyqk/yzyzl`,
        method: 'get',
        mockFilter: (req, mockDataName = "yzyzl") => {
            return query(mockDataName)
        },
        params: options
    })
}

/**
 * 云主机类型、云资源信创情况数据
 * @param {} options 
 * @returns 
 */
export function getLeftUsageRateData(options = {}) {
    return request({
        url: `sjzt/yzyqk/yzj`,
        method: 'get',
        mockFilter: (req, mockDataName = "yzj") => {
            return query(mockDataName)
        },
        params: options
    })
}

/**
 * 资讯统计
 * @param {} options 
 * @returns 
 */
export function getConsultData(options = {}) {
    return request({
        url: `sjzt/ywyw/zxtj`,
        method: 'get',
        mockFilter: (req, mockDataName = "consult") => {
            return query(mockDataName)
        },
        params: options
    })
}
/**
 * 资讯分布统计
 * @param {} options 
 * @returns 
 */
export function getDistributionData(options = {}) {
    return request({
        url: `sjzt/ywyw/zxfb`,
        method: 'get',
        mockFilter: (req, mockDataName = "distribution") => {
            return query(mockDataName)
        },
        params: options
    })
}
/**
 * 知识总量
 * @param {} options 
 * @returns 
 */
export function getKnowageNumData(options = {}) {
    return request({
        url: `sjzt/ywyw/zszl`,
        method: 'get',
        mockFilter: (req, mockDataName = "zszl") => {
            return query(mockDataName)
        },
        params: options
    })
}
/**
 * 知识建设echart图
 * @param {} options 
 * @returns 
 */
export function getKnowageData(options = {}) {
    return request({
        url: `sjzt/ywyw/zskml`,
        method: 'get',
        mockFilter: (req, mockDataName = "zskml") => {
            return query(mockDataName)
        },
        params: options
    })
}

/**
 * 信创饼图数据
 * @param {} options 
 * @returns 
 */
export function getPieData(options = {}) {
    return request({
        url: `sjzt/yzyqk/xcbt`,
        method: 'get',
        mockFilter: (req, mockDataName = "xcbt") => {
            return query(mockDataName)
        },
        params: options
    })
}